package com.hp.tiger.concurrent.classloader.chapter1;

import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @author XavierDong
 **/
public class ClinitThreadTest {

    public static void main(String[] args) {

        new Thread() {
            @Override
            public void run() {
                new SimpleObject();
            }
        }.start();

        new Thread() {
            @Override
            public void run() {
                new SimpleObject();
            }
        }.start();


    }

    static class SimpleObject {

        private static AtomicBoolean init = new AtomicBoolean(true);

        static {
            System.out.println(Thread.currentThread().getName() + " I will be initial.");
            while (init.get()) {

            }
            System.out.println(Thread.currentThread().getName() + " I am finish initial.");
        }
    }
}
